﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
using Kooboo.HtmlFunc.Function;
using Kooboo.HtmlFunc.Providers;

namespace Kooboo.HtmlFunc.Analysis.Visitors
{
    public class ImgTagVisitor : VisitorBase
    {
        public ImgTagVisitor(VisitorContext context)
            : base(context)
        {
        }

        public override void VisitNode(HtmlNode node)
        {
            if (node.Is("IMG"))
            {
                var imgTag = Provider.Factory.GetProvider<IImgTag>();
                imgTag.Node = node;
                this.Context.Result.ImgTags.Add(imgTag);
            }
        }
    }
}
